home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12817 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.spies.com!usenet
  2. From: Erik Max Francis <max@alcyone.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Passing Function Pointers
  5. Date: Tue, 02 Apr 1996 08:15:30 -0800
  6. Organization: Alcyone Systems
  7. Message-ID: <316152A2.6A1B5ED6@alcyone.com>
  8. References: <315E7284.479F@sooner.net>
  9. NNTP-Posting-Host: newton.alcyone.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
  14.  
  15. Eddie Bush wrote:
  16.  
  17. > I made *fn an int because it didn't like the void, and now instead of
  18. > complaining about that it complains about - well, here's the error
  19. > message:
  20. > Error LIST.H 71:  Call to nonfunction.
  21. > Any ideas?  It isn't 'clicking' for me.
  22.  
  23. The reason is because (surprise!) you are passing a pointer to an int, not a
  24. pointer to a function returning int and taking one argument which is a l_node.
  25. (But if you're going to delete it, don't you want it to be an l_node *?  Maybe
  26. you've already typedef'd it this way.)
  27.  
  28. The prototype should look this:
  29.  
  30.     void delete(list *myList, int (*function)(l_node));
  31.  
  32. -- 
  33. Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
  34. San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
  35. H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
  36. Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
  37. "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
  38.